<script>
  const map = {
    '1001': { id: '1001', name: '一级' },
    '1002': { id: '1001', name: '二级' },
    '1003': { id: '1001', name: '三级' },
  }

  let target = {
    id: '1002'
  }

  let target1 = {
    id: '10'
  }
  
  // 把对象的key拿出来组合成一个数组 通过数组查找判断方法
  const keys = Object.keys(map)
  console.log(keys)
  console.log(keys.includes(target.id))
  console.log(keys.includes(target1.id))

  // 取巧
  console.log(map[target.id])
  console.log(map[target1.id])
  if(map[target1.id]){
    console.log('找到了')
  }
</script>